/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import dto.Account;
import java.rmi.RemoteException;
import service.ChatServerService;
import view.MainFrame;

/**
 *
 * @author BLACK
 */
public class ReplyThread extends Thread{
    Account senderAccount, recieverAccount;
    int reply;
    ChatServerService serv;
    MainFrame mainFrameRef;
    
    public ReplyThread(ChatServerService serv, Account senderAccount,Account recieverAccount, int reply, MainFrame MainFrameRef)
    {
        this.senderAccount= senderAccount;
        this.recieverAccount= recieverAccount;
        this.reply= reply;
        this.serv= serv;
        this.mainFrameRef=mainFrameRef;
        
    }
    /**
     * thread to make the process of replying to a friend request.
     */
    public void run ()
    {
        try {
            serv.friendRequestReply(senderAccount, recieverAccount,reply); 
            if(reply == 0 && mainFrameRef!= null)
                mainFrameRef.renderContactList();
        } catch (RemoteException ex) {
            ex.printStackTrace();
        }
   
    }

}
